<template>
  <div id="App">
    <!--父组件监听子组件触发的自定义事件-->
    <count :num="num" @add="add" @sub="sub"></count>
  </div>
</template>
<script>


import Count from "@/components/count.vue";

export default {
  name: "App",
  components: {Count},
  data() {
    return {
      num: 0
    }
  },
  methods: {
    add(value) {this.num += value},
    sub(value) {this.num -= value}
  }

}
</script>
<style lang="less">

</style>
